Skip to main content
GET
/
api
/
pedidos
/
{pedidoId}
/
detalles
Get Order Details
curl --request GET \
  --url https://api.example.com/api/pedidos/{pedidoId}/detalles
{
  "200": {},
  "401": {},
  "403": {},
  "404": {},
  "detalles": [
    {
      "detalle_id": 123,
      "producto_id": 123,
      "nombre": "<string>",
      "cantidad": 123,
      "precioUnitario": 123,
      "subtotal": 123
    }
  ]
}

Authentication

This endpoint requires JWT authentication. Include the Bearer token in the Authorization header.

Path Parameters

pedidoId
long
required
The unique identifier of the order whose details you want to retrieve

Response

Returns an array of order detail objects (line items) for the specified order.
detalles
array
Array of order line items

Example Request

cURL
curl -X GET "http://localhost:8080/api/pedidos/123/detalles" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
JavaScript
const response = await fetch('http://localhost:8080/api/pedidos/123/detalles', {
  headers: {
    'Authorization': `Bearer ${token}`
  }
});
const details = await response.json();
Python
import requests

headers = {
    'Authorization': f'Bearer {token}'
}
response = requests.get(
    'http://localhost:8080/api/pedidos/123/detalles',
    headers=headers
)
details = response.json()

Example Response

[
  {
    "detalle_id": 1,
    "producto_id": 5,
    "nombre": "Sofá Klippan 2 plazas",
    "cantidad": 1,
    "precioUnitario": 299.00,
    "subtotal": 299.00
  },
  {
    "detalle_id": 2,
    "producto_id": 12,
    "nombre": "Mesa de centro Lack",
    "cantidad": 2,
    "precioUnitario": 49.99,
    "subtotal": 99.98
  }
]

Status Codes

200
OK
Order details retrieved successfully
401
Unauthorized
Missing or invalid JWT token
403
Forbidden
User does not have permission to view this order
404
Not Found
Order with specified ID not found

Use Cases

  • Order summary: Display itemized breakdown of an order
  • Invoice generation: Get line items for creating invoices
  • Order modification: Retrieve current items before allowing edits
  • Inventory tracking: Track which products were sold in each order
Prices in order details are locked at the time of purchase and may differ from current product prices.